# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'queryBuilder.ui'
#
# Created: Tue Jul 26 14:21:00 2011
#      by: PyQt4 UI code generator 4.8.4
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    _fromUtf8 = lambda s: s

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(730, 436)
        self.verticalLayout_7 = QtGui.QVBoxLayout(Dialog)
        self.verticalLayout_7.setObjectName(_fromUtf8("verticalLayout_7"))
        self.horizontalLayout_6 = QtGui.QHBoxLayout()
        self.horizontalLayout_6.setObjectName(_fromUtf8("horizontalLayout_6"))
        self.verticalLayout_3 = QtGui.QVBoxLayout()
        self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3"))
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.verticalLayout = QtGui.QVBoxLayout()
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.label = QtGui.QLabel(Dialog)
        self.label.setObjectName(_fromUtf8("label"))
        self.verticalLayout.addWidget(self.label)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.horizontalLayout.addLayout(self.verticalLayout)
        self.col = MyTextEdit(Dialog)
        self.col.setMinimumSize(QtCore.QSize(400, 0))
        self.col.setObjectName(_fromUtf8("col"))
        self.horizontalLayout.addWidget(self.col)
        self.verticalLayout_3.addLayout(self.horizontalLayout)
        self.horizontalLayout_2 = QtGui.QHBoxLayout()
        self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.horizontalLayout_2.addWidget(self.label_2)
        self.tab = QtGui.QLineEdit(Dialog)
        self.tab.setObjectName(_fromUtf8("tab"))
        self.horizontalLayout_2.addWidget(self.tab)
        self.verticalLayout_3.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_3 = QtGui.QHBoxLayout()
        self.horizontalLayout_3.setObjectName(_fromUtf8("horizontalLayout_3"))
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self.label_3 = QtGui.QLabel(Dialog)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.verticalLayout_2.addWidget(self.label_3)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem1)
        self.horizontalLayout_3.addLayout(self.verticalLayout_2)
        self.where = MyTextEdit(Dialog)
        self.where.setObjectName(_fromUtf8("where"))
        self.horizontalLayout_3.addWidget(self.where)
        self.verticalLayout_3.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_4 = QtGui.QHBoxLayout()
        self.horizontalLayout_4.setObjectName(_fromUtf8("horizontalLayout_4"))
        self.label_4 = QtGui.QLabel(Dialog)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.horizontalLayout_4.addWidget(self.label_4)
        self.group = QtGui.QLineEdit(Dialog)
        self.group.setObjectName(_fromUtf8("group"))
        self.horizontalLayout_4.addWidget(self.group)
        self.label_6 = QtGui.QLabel(Dialog)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.horizontalLayout_4.addWidget(self.label_6)
        self.verticalLayout_3.addLayout(self.horizontalLayout_4)
        self.horizontalLayout_5 = QtGui.QHBoxLayout()
        self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
        self.label_5 = QtGui.QLabel(Dialog)
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.horizontalLayout_5.addWidget(self.label_5)
        self.order = QtGui.QLineEdit(Dialog)
        self.order.setObjectName(_fromUtf8("order"))
        self.horizontalLayout_5.addWidget(self.order)
        self.label_7 = QtGui.QLabel(Dialog)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.horizontalLayout_5.addWidget(self.label_7)
        self.verticalLayout_3.addLayout(self.horizontalLayout_5)
        self.horizontalLayout_6.addLayout(self.verticalLayout_3)
        self.verticalLayout_4 = QtGui.QVBoxLayout()
        self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
        self.toolBox = QtGui.QToolBox(Dialog)
        self.toolBox.setMaximumSize(QtCore.QSize(300, 16777215))
        self.toolBox.setObjectName(_fromUtf8("toolBox"))
        self.page = QtGui.QWidget()
        self.page.setGeometry(QtCore.QRect(0, 0, 250, 300))
        self.page.setObjectName(_fromUtf8("page"))
        self.verticalLayout_5 = QtGui.QVBoxLayout(self.page)
        self.verticalLayout_5.setObjectName(_fromUtf8("verticalLayout_5"))
        self.checkBox = QtGui.QCheckBox(self.page)
        font = QtGui.QFont()
        font.setPointSize(8)
        self.checkBox.setFont(font)
        self.checkBox.setObjectName(_fromUtf8("checkBox"))
        self.verticalLayout_5.addWidget(self.checkBox)
        self.tables = QtGui.QComboBox(self.page)
        self.tables.setObjectName(_fromUtf8("tables"))
        self.tables.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.tables)
        self.columns = QtGui.QComboBox(self.page)
        self.columns.setObjectName(_fromUtf8("columns"))
        self.columns.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.columns)
        spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout_5.addItem(spacerItem2)
        self.line_2 = QtGui.QFrame(self.page)
        self.line_2.setFrameShape(QtGui.QFrame.HLine)
        self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_2.setObjectName(_fromUtf8("line_2"))
        self.verticalLayout_5.addWidget(self.line_2)
        self.aggregates = QtGui.QComboBox(self.page)
        self.aggregates.setObjectName(_fromUtf8("aggregates"))
        self.aggregates.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.aggregates)
        self.functions = QtGui.QComboBox(self.page)
        self.functions.setObjectName(_fromUtf8("functions"))
        self.functions.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.functions)
        self.math = QtGui.QComboBox(self.page)
        self.math.setObjectName(_fromUtf8("math"))
        self.math.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.math)
        self.stringfct = QtGui.QComboBox(self.page)
        self.stringfct.setObjectName(_fromUtf8("stringfct"))
        self.stringfct.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.stringfct)
        self.operators = QtGui.QComboBox(self.page)
        self.operators.setObjectName(_fromUtf8("operators"))
        self.operators.addItem(_fromUtf8(""))
        self.verticalLayout_5.addWidget(self.operators)
        self.toolBox.addItem(self.page, _fromUtf8(""))
        self.page_2 = QtGui.QWidget()
        self.page_2.setGeometry(QtCore.QRect(0, 0, 250, 300))
        self.page_2.setObjectName(_fromUtf8("page_2"))
        self.verticalLayout_6 = QtGui.QVBoxLayout(self.page_2)
        self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6"))
        self.columns_2 = QtGui.QComboBox(self.page_2)
        self.columns_2.setObjectName(_fromUtf8("columns_2"))
        self.columns_2.addItem(_fromUtf8(""))
        self.verticalLayout_6.addWidget(self.columns_2)
        self.extract = QtGui.QCheckBox(self.page_2)
        self.extract.setObjectName(_fromUtf8("extract"))
        self.verticalLayout_6.addWidget(self.extract)
        self.values = QtGui.QListView(self.page_2)
        self.values.setMaximumSize(QtCore.QSize(16777215, 16777215))
        self.values.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
        self.values.setProperty(_fromUtf8("showDropIndicator"), False)
        self.values.setDragEnabled(False)
        self.values.setDragDropMode(QtGui.QAbstractItemView.NoDragDrop)
        self.values.setObjectName(_fromUtf8("values"))
        self.verticalLayout_6.addWidget(self.values)
        self.toolBox.addItem(self.page_2, _fromUtf8(""))
        self.page_3 = QtGui.QWidget()
        self.page_3.setGeometry(QtCore.QRect(0, 0, 250, 300))
        self.page_3.setObjectName(_fromUtf8("page_3"))
        self.verticalLayout_8 = QtGui.QVBoxLayout(self.page_3)
        self.verticalLayout_8.setObjectName(_fromUtf8("verticalLayout_8"))
        self.table_idx = QtGui.QComboBox(self.page_3)
        self.table_idx.setObjectName(_fromUtf8("table_idx"))
        self.table_idx.addItem(_fromUtf8(""))
        self.verticalLayout_8.addWidget(self.table_idx)
        self.table_target = QtGui.QComboBox(self.page_3)
        self.table_target.setObjectName(_fromUtf8("table_target"))
        self.table_target.addItem(_fromUtf8(""))
        self.verticalLayout_8.addWidget(self.table_target)
        self.Rtree = QtGui.QComboBox(self.page_3)
        self.Rtree.setObjectName(_fromUtf8("Rtree"))
        self.Rtree.addItem(_fromUtf8(""))
        self.verticalLayout_8.addWidget(self.Rtree)
        self.usertree = QtGui.QPushButton(self.page_3)
        self.usertree.setObjectName(_fromUtf8("usertree"))
        self.verticalLayout_8.addWidget(self.usertree)
        spacerItem3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.verticalLayout_8.addItem(spacerItem3)
        self.toolBox.addItem(self.page_3, _fromUtf8(""))
        self.verticalLayout_4.addWidget(self.toolBox)
        self.horizontalLayout_6.addLayout(self.verticalLayout_4)
        self.verticalLayout_7.addLayout(self.horizontalLayout_6)
        self.horizontalLayout_7 = QtGui.QHBoxLayout()
        self.horizontalLayout_7.setObjectName(_fromUtf8("horizontalLayout_7"))
        self.save = QtGui.QPushButton(Dialog)
        self.save.setMaximumSize(QtCore.QSize(50, 16777215))
        self.save.setObjectName(_fromUtf8("save"))
        self.horizontalLayout_7.addWidget(self.save)
        self.load = QtGui.QPushButton(Dialog)
        self.load.setMaximumSize(QtCore.QSize(50, 16777215))
        self.load.setObjectName(_fromUtf8("load"))
        self.horizontalLayout_7.addWidget(self.load)
        self.reset = QtGui.QPushButton(Dialog)
        self.reset.setMaximumSize(QtCore.QSize(50, 16777215))
        self.reset.setObjectName(_fromUtf8("reset"))
        self.horizontalLayout_7.addWidget(self.reset)
        spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout_7.addItem(spacerItem4)
        self.buttonBox = QtGui.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setCenterButtons(True)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.horizontalLayout_7.addWidget(self.buttonBox)
        self.verticalLayout_7.addLayout(self.horizontalLayout_7)

        self.retranslateUi(Dialog)
        self.toolBox.setCurrentIndex(0)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked(bool)")), self.order.clear)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.group.clear)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.where.clear)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.tab.clear)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.col.clear)
        QtCore.QObject.connect(self.reset, QtCore.SIGNAL(_fromUtf8("clicked()")), self.columns.clear)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("Dialog", "Columns", None, QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(QtGui.QApplication.translate("Dialog", "Tables     ", None, QtGui.QApplication.UnicodeUTF8))
        self.label_3.setText(QtGui.QApplication.translate("Dialog", "Where    ", None, QtGui.QApplication.UnicodeUTF8))
        self.label_4.setText(QtGui.QApplication.translate("Dialog", "Group By \n"
"Columns", None, QtGui.QApplication.UnicodeUTF8))
        self.label_6.setText(QtGui.QApplication.translate("Dialog", "(Column number:1,2,...)", None, QtGui.QApplication.UnicodeUTF8))
        self.label_5.setText(QtGui.QApplication.translate("Dialog", "Order By \n"
"Columns", None, QtGui.QApplication.UnicodeUTF8))
        self.label_7.setText(QtGui.QApplication.translate("Dialog", "(Idem + ASC/DESC)", None, QtGui.QApplication.UnicodeUTF8))
        self.checkBox.setText(QtGui.QApplication.translate("Dialog", "Show system tables", None, QtGui.QApplication.UnicodeUTF8))
        self.tables.setItemText(0, QtGui.QApplication.translate("Dialog", "Tables", None, QtGui.QApplication.UnicodeUTF8))
        self.columns.setItemText(0, QtGui.QApplication.translate("Dialog", "Columns", None, QtGui.QApplication.UnicodeUTF8))
        self.aggregates.setItemText(0, QtGui.QApplication.translate("Dialog", "Aggregates", None, QtGui.QApplication.UnicodeUTF8))
        self.functions.setItemText(0, QtGui.QApplication.translate("Dialog", "Functions", None, QtGui.QApplication.UnicodeUTF8))
        self.math.setItemText(0, QtGui.QApplication.translate("Dialog", "Math", None, QtGui.QApplication.UnicodeUTF8))
        self.stringfct.setItemText(0, QtGui.QApplication.translate("Dialog", "Strings functions", None, QtGui.QApplication.UnicodeUTF8))
        self.operators.setItemText(0, QtGui.QApplication.translate("Dialog", "Operators", None, QtGui.QApplication.UnicodeUTF8))
        self.toolBox.setItemText(self.toolBox.indexOf(self.page), QtGui.QApplication.translate("Dialog", "Datas", None, QtGui.QApplication.UnicodeUTF8))
        self.columns_2.setItemText(0, QtGui.QApplication.translate("Dialog", "Columns", None, QtGui.QApplication.UnicodeUTF8))
        self.extract.setText(QtGui.QApplication.translate("Dialog", "Only 10 First Values", None, QtGui.QApplication.UnicodeUTF8))
        self.toolBox.setItemText(self.toolBox.indexOf(self.page_2), QtGui.QApplication.translate("Dialog", "Columns\'Values", None, QtGui.QApplication.UnicodeUTF8))
        self.table_idx.setItemText(0, QtGui.QApplication.translate("Dialog", "Table (with Spatial Index)", None, QtGui.QApplication.UnicodeUTF8))
        self.table_target.setItemText(0, QtGui.QApplication.translate("Dialog", "Table (Target)", None, QtGui.QApplication.UnicodeUTF8))
        self.Rtree.setItemText(0, QtGui.QApplication.translate("Dialog", "Rtree Operation", None, QtGui.QApplication.UnicodeUTF8))
        self.usertree.setText(QtGui.QApplication.translate("Dialog", "Use Spatial Index", None, QtGui.QApplication.UnicodeUTF8))
        self.toolBox.setItemText(self.toolBox.indexOf(self.page_3), QtGui.QApplication.translate("Dialog", "Spatial Index", None, QtGui.QApplication.UnicodeUTF8))
        self.save.setText(QtGui.QApplication.translate("Dialog", "Save", None, QtGui.QApplication.UnicodeUTF8))
        self.load.setText(QtGui.QApplication.translate("Dialog", "Load", None, QtGui.QApplication.UnicodeUTF8))
        self.reset.setText(QtGui.QApplication.translate("Dialog", "&Reset", None, QtGui.QApplication.UnicodeUTF8))

#my own text edit
class MyTextEdit(QtGui.QTextEdit):
	def __init__(self, parent=None):
		super(MyTextEdit, self).__init__(parent)
		self.parent=parent
		self.active=0

	def focusInEvent(self, event):
		super(MyTextEdit, self).focusInEvent(event)
		self.parent.ui.where.active=0 # if focus on col, loose focus on where
		self.active=1 

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    Dialog = QtGui.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())

